package com.sl.hx.shop.utils;

import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

/**
 * @author hwg
 * @date 2017/11/7
 */

public class SoftKeyboardHelper {

    public static boolean isActive(Context context){
        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        return imm.isActive() ;
    }

    public static void hide(Context context, View view){
        InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
        //强制隐藏键盘
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }

}
